<template>
  <e-table
    ref="eTable"
    :tableData="tableData"
    :columns="columns"
    :loading="loading"
    :pageObj="null"
    :border="null"
    :maxHeight="260"
    @row-click="handleRowClick"
  />
</template>

<script>
import { getServiceWindowTotal } from '@/api/monitor'
import { getMonitorTime } from '@/utils/util'

export default {
  data() {
    return {
      tableData: [],
      columns: [
        {
          label: '姓名',
          prop: 'userName'
        },
        {
          label: '满意率',
          prop: 'satisfyRate'
        },
        {
          label: '评价数',
          prop: 'total'
        }
      ],
      loading: false
    }
  },
  mounted() {
    let param = getMonitorTime()
    this.getWindow({ ...param })
  },
  methods: {
    getWindow(param) {
      getServiceWindowTotal(param).then(res => {
        console.log('res', res)
        if (res.state === '000000') {
          this.tableData = res.data
        }
      })
    },
    handleRowClick(row, column, event) {
      console.log('rowClick', row, column, event)
      this.$router.push({
        path: '/monitor/monitor-windowDetail',
        query: { row: JSON.stringify(row) }
      })
    }
  }
}
</script>
